<?php
session_start();
?>
<html>
 <head>
 <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
 <title>Google Map API V3 with markers</title>
 <style type="text/css">
 #map { width: 800px; height: 600px; border: 0px; padding: 0px; }
 </style>
 <script type="text/javascript"
      src="http://maps.googleapis.com/maps/api/js?key=AIzaSyBSUr5wSJQTnr2YsTMywLsGaXQZdX65T5g&sensor=false">
 </script>
 <script type="text/javascript">
 //Sample code written by August Li
 var icon = new google.maps.MarkerImage("http://maps.google.com/mapfiles/ms/micons/blue.png",
 new google.maps.Size(32, 32), new google.maps.Point(0, 0),
 new google.maps.Point(16, 32));
 var center = null;
 var map = null;
 var currentPopup;
 var bounds = new google.maps.LatLngBounds();
 function addMarker(lat, lng, info) {
 var pt = new google.maps.LatLng(lat, lng);
 bounds.extend(pt);
 var marker = new google.maps.Marker({
 position: pt,
 icon: icon,
 map: map
 });
 var popup = new google.maps.InfoWindow({
 content: info,
 maxWidth: 300
 });
 google.maps.event.addListener(marker, "click", function() {
 if (currentPopup != null) {
 currentPopup.close();
 currentPopup = null;
 }
 popup.open(map, marker);
 currentPopup = popup;
 });
 google.maps.event.addListener(popup, "closeclick", function() {
 map.panTo(center);
 currentPopup = null;
 });
 }
 function initMap() {
 map = new google.maps.Map(document.getElementById("map"), {
 center: new google.maps.LatLng(0, 0),
 zoom: 14,
 mapTypeId: google.maps.MapTypeId.ROADMAP,
 mapTypeControl: false,
 mapTypeControlOptions: {
 style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR
 },
 navigationControl: true,
 navigationControlOptions: {
 style: google.maps.NavigationControlStyle.SMALL
 }
 });
 addMarker(6.9172448, 79.8763065, '<b>Lady Ridgeway Hospital</b><br/>Colombo 08');

<?php
$pid = $_SESSION['pid'];
$name = $_SESSION['name'];
include_once '../conf/conf.php';
  $sql = "SELECT * FROM gis WHERE pid = '$pid'";
  $res = mysqli_query($con, $sql) or die("Couldn't get FIRST record");
  $row = mysqli_fetch_assoc($res);
  extract($row);
  echo "addMarker($y, $x,'<b>$name</b><br >$pid');" 
 ?>
 center = bounds.getCenter();
 map.fitBounds(bounds);

 }
 </script>
 </head>
 <body onload="initMap()" style="margin:0px; border:0px; padding:0px;"><div id="map"></div></body></html>